use "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Chapter 7 Clientelism\Data\aggregate data for andyjoby paper New.dta" , clear

impute tvs tvsurv, gen(tvsimp)

reg clientcountry tvsimp, vce(robust)
predict xb

corr clientcountry tvsimp
pcorr clientcountry tvsimp pppstan 

*Figure 7.6

scatter clientcountry tvsimp , mlab(pais) mlabcolor(black) ///
msym(o) mcolor(black) mlabpos(12) legend(off) xtitle("{bf:Percentage of Households with a Television}") ///
ytitle("{bf:Prevalence of Clientelism}" "(percentage of respondents who have" "received a clientelistic payoff)") graphregion(color(white)) plotregion(lstyle(yxline) lcolor(black)) yscale(range(0 .45)) ///
note("{it:r} = -.39", size(medium)) ylab(0 "0%" .1 "10%" .2 "20%" .3 "30%" .4 "40%") xlab(0 "0%" 20 "20%" 40 "40%" 60 "60%" 80 "80%" 100 "100%")

graph export "C:\Users\Andy Baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Chapter 7 Clientelism\Figures\chapter 7 aggregate TVs.tif", as(tif) replace
graph export "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Publishers\Final Manuscript\Final Figures\BAR7_6.tif", as(tif) replace width(1500)
graph export "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Publishers\Final Manuscript\Final Figures\BAR7_6.pdf", as(pdf) replace 

/*
scatter clientcountry xb tvsimp , mlab(pais) mlabcolor(black) connect(. l) lcolor(black black) ///
msym(o i) mcolor(black) mlabpos(12 12) legend(off) xtitle("{bf:Percentage of Households with a Television}") ///
ytitle("{bf:Prevalence of Clientelism}" "(percentage of respondents who have" "received a clientelistic payoff)") graphregion(color(white)) plotregion(lstyle(yxline) lcolor(black)) yscale(range(0 .45)) ///
note("{it:r} = -.39", size(medium)) ylab(0 "0%" .1 "10%" .2 "20%" .3 "30%" .4 "40%") xlab(0 "0%" 20 "20%" 40 "40%" 60 "60%" 80 "80%" 100 "100%")
